// ignore: file_names
// ignore: file_names
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';

class UserInfoContent extends StatefulWidget {
  const UserInfoContent({Key? key}) : super(key: key);

  @override
  State<UserInfoContent> createState() => _UserInfoContentState();
}

class _UserInfoContentState extends State<UserInfoContent> {
  final GFBottomSheetController _controller = GFBottomSheetController();
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  List<BrnCommonActionSheetItem> actions = [
    BrnCommonActionSheetItem(
      '拍照',
      actionStyle: BrnCommonActionSheetItemStyle.normal,
    ),
    BrnCommonActionSheetItem(
      '从相册选择',
      actionStyle: BrnCommonActionSheetItemStyle.normal,
    )
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar:
          GFAppBar(title: const Text("用户资料"), backgroundColor: Colors.green),
      body: ListView(
        children: [
          GFCard(
            boxFit: BoxFit.cover,
            content: Column(children: [
              GFListTile(
                icon: Row(
                  children: [
                    GestureDetector(
                      child: const GFAvatar(),
                      onTap: () async {
                       List?  res = await showModalBottomSheet(
                            context: context,
                            backgroundColor: Colors.transparent,
                            builder: (BuildContext context) {
                              return BrnCommonActionSheet(
                                actions: actions,
                                clickCallBack: (
                                  int index,
                                  BrnCommonActionSheetItem actionEle,
                                ) {
                                  String title = actionEle.title;
                                  BrnToast.show(
                                      "title: $title, index: $index", context);
                                },
                              );
                            });
                        // ignore: avoid_print
                       if(res!= null){
                         print(res[0]);
                       }else{
                         print(res);
                       }

                      },
                    ),
                    const Icon(
                      Icons.arrow_right,
                      color: Colors.grey,
                    )
                  ],
                ),
                title: const Text('头像'),
              ),
              const Divider(
                height: 1,
                color: Colors.grey,
                indent: 25,
              ),
              GFListTile(
                icon: Row(
                  children: const [
                    Text('15325524278'),
                    Icon(
                      Icons.arrow_right,
                      color: Colors.grey,
                    )
                  ],
                ),
                title: const Text('手机号码'),
              ),
              const Divider(
                height: 1,
                color: Colors.grey,
                indent: 25,
              ),
              GFListTile(
                icon: Row(
                  children: const [
                    Text('MASC1234567890'),
                    Icon(
                      Icons.arrow_right,
                      color: Colors.grey,
                    )
                  ],
                ),
                title: const Text('昵称'),
              ),
              const Divider(
                height: 1,
                color: Colors.grey,
                indent: 25,
              ),
              GFListTile(
                icon: Row(
                  children: const [
                    Text('未认证'),
                    Icon(
                      Icons.arrow_right,
                      color: Colors.grey,
                    )
                  ],
                ),
                title: const Text('性别'),
              ),
              const Divider(
                height: 1,
                color: Colors.grey,
                indent: 25,
              ),
              GFListTile(
                icon: Row(
                  children: const [
                    Text('未认证'),
                    Icon(
                      Icons.arrow_right,
                      color: Colors.grey,
                    )
                  ],
                ),
                title: const Text('真实姓名'),
              ),
              const Divider(
                height: 1,
                color: Colors.grey,
                indent: 25,
              ),
              GFListTile(
                icon: Row(
                  children: const [
                    Text('未认证'),
                    Icon(
                      Icons.arrow_right,
                      color: Colors.grey,
                    )
                  ],
                ),
                title: const Text('身份证号'),
              ),
              const Divider(
                height: 1,
                color: Colors.grey,
                indent: 25,
              ),
              GFListTile(
                icon: Row(
                  children: const [
                    Icon(
                      Icons.arrow_right,
                      color: Colors.grey,
                    )
                  ],
                ),
                title: const Text('联系地址'),
              ),
            ]),
          ),
        ],
      ),
      // bottomSheet: GFBottomSheet(
      //   controller: _controller,
      //   maxContentHeight: 200,
      //   stickyHeaderHeight: 150,
      //   contentBody: Container(
      //     height: 150,
      //     margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
      //     child: ListView(
      //       shrinkWrap: true,
      //       physics: const ScrollPhysics(),
      //       children: [
      //         GFButton(
      //           child: const Text(
      //             '拍照',
      //             style: TextStyle(color: Colors.black),
      //           ),
      //           fullWidthButton: true,
      //           color: GFColors.WHITE,
      //           onPressed: () {},
      //         ),

      //         GFButton(
      //           child: const Text(
      //             '从相册选择',
      //             style: TextStyle(color: Colors.black),
      //           ),
      //           fullWidthButton: true,
      //           color: GFColors.WHITE,
      //           onPressed: () {},
      //         ),

      //         GFButton(
      //           child: const Text(
      //             '取消',
      //             style: TextStyle(color: Colors.black),
      //           ),
      //           fullWidthButton: true,
      //           color: GFColors.WHITE,
      //           onPressed: () {
      //             _controller.isBottomSheetOpened
      //                 ? _controller.hideBottomSheet()
      //                 : _controller.showBottomSheet();
      //           },
      //         ),
      //       ],
      //     ),
      //   ),
      //   stickyFooterHeight: 50,
      // ),
    );
  }
}
